package com.cosina.mr.model;

import com.cosina.mr.util.StringUtil;


public class MoneyEvent {
	
	public static String NAME = "name" ,
						DESC = "desc",
						OCCURTIME = "occur_time",
						MONEY = "money",
						ID = "_id";
	
	private final String id;
	private final String name, desc , occurTime;
	private final long money;
	
	private final static String OLD_OBJECT_ID_FLAG = "-1";
	
	public MoneyEvent(String name,String desc,long money,String date){
		this(OLD_OBJECT_ID_FLAG,name,desc,money,date);
	}
	
	public MoneyEvent(String id,String name,String desc,long money,String date){
		if(StringUtil.isBlank(id)){
			id = OLD_OBJECT_ID_FLAG;
		}
		this.id = id;
		this.name = name;
		this.desc = desc;
		this.money = money;
		this.occurTime = date;
	}
	
	public boolean isOld(){
		return OLD_OBJECT_ID_FLAG.equals(id) == false;
	}
	
	public String getId(){
		return id;
	}
	
	public String getName() {
		return name;
	}

	public String getDesc() {
		return desc;
	}

	public String getOccurTime() {
		return occurTime;
	}

	public long getMoney() {
		return money;
	}

	public Object[] getInsertArg(){
		return new Object[]{null,name,desc,money,occurTime};
	}
	
	public static String[] getListViewColumnNames(){
		return new String[]{ID,OCCURTIME,NAME,MONEY,DESC};
	}
}
